<template>
    <div class="home-container">
        <div class="home-content">
            <Button @click="test">post测试</Button>
            <Button @click="get">get方法测试</Button>
            <Input :rows="10" style="margin-top: 20px" v-model="dataUrl" type="textarea" />
            <Input :rows="10" style="margin-top: 20px" v-model="postData" type="textarea" />
            <Input :rows="10" style="margin-top:20px" v-model="userInfo" type="textarea"/>
        </div>
    </div>
</template>

<script>
import { testGet, testPost } from '@/api'

export default {
    name: 'home',
    data() {
        return {
            userInfo: '',
            postData: '',
            dataUrl: '',
        }
    },
    methods: {
        get() {
            this.userInfo = ''
            testGet(this.dataUrl, JSON.parse(this.postData)).then(res => {
                this.userInfo = JSON.stringify(res, null, 4)
            })
        },
        test() {
            this.userInfo = ''
            testPost(this.dataUrl, JSON.parse(this.postData)).then(res => {
                this.userInfo = JSON.stringify(res, null, 4)
            })
        },

    },
}
</script>

<style scoped>
.home-container {
    padding: 10px;
    padding-top: 5px;
}
.home-content {
    padding: 10px;
    border-radius: 5px;
    background: #fff;
}
</style>
